public class MaxDivisorCount {
    public static int countDivisors(int num) {
        int count = 0;
        for (int i = 1; i <= num; i++) {
            if (num % i == 0) {
                count++;
            }
        }
        return count;
    }

    public static int findNumberWithMaxDivisors(int a, int b) {
        int maxDivisors = 0;
        int numberWithMaxDivisors = 0;

        for (int num = a; num <= b; num++) {
            int divisors = countDivisors(num);
            if (divisors > maxDivisors) {
                maxDivisors = divisors;
                numberWithMaxDivisors = num;
            }
        }

        return numberWithMaxDivisors;
    }

    public static void main(String[] args) {
        int a = 1;
        int b = 36;
        int result = findNumberWithMaxDivisors(a, b);
        System.out.println("在 " + a + " 和 " + b + " 之间，约数个数最多的数是 " + result);
    }
}
